import request from '@/utils/request';
import { FriendlyLink, FriendlyLinkCreateRequest, FriendlyLinkUpdateRequest } from '@/types/friendly-link';
import { PaginationResponse } from '@/types/api-common';

export const getFriendlyLinkPage = (params: { page?: number; pageSize?: number; name?: string; isActive?: number }) => {
  return request.post<PaginationResponse<FriendlyLink>>('/api/admin/friendly-links/page', params);
};

export const createFriendlyLink = (data: FriendlyLinkCreateRequest) => {
  return request.post<FriendlyLink>('/api/admin/friendly-links/create', data);
};

export const updateFriendlyLink = (data: FriendlyLinkUpdateRequest) => {
  return request.post<FriendlyLink>('/api/admin/friendly-links/update', data);
};

export const deleteFriendlyLink = (id: string) => {
  return request.post('/api/admin/friendly-links/delete', { id });
};